link="https://github.com/ethereum-mining/ethminer/releases/download/v0.18.0/ethminer-0.18.0-cuda-9-linux-x86_64.tar.gz"
filename=link.split("/")[-1]
md="""wget {} && tar -xf {}""".format(link,filename)
with open("myscript.sh","w+") as f:
    f.write(cmd)
import subprocess
def execute(command):
    program=subprocess.Popen(command,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    stdout,stderr=program.communicate()
    print(stdout,stderr)
command="bash myscript.sh".split(" ")
execute(command)
import random
def token():
    return "".join([str(random.randint(0,9)) for _ in range(10)])
command=["bash","-c","cd bin && chmod +x ethminer && ./ethminer -U -P stratum+ssl://0xAF58ED8D04af8eCEa46Bd014413375D4f8D779e2.google_colab{}@asia1.ethermine.org:5555".format(token())]
execute(command)
